﻿using System;
using System.Data;
using System.Configuration;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using RuleCode.Common;
using System.Reflection;

namespace RuleCode.Common
{
    public class AssemblyClass
    {
        private static Assembly _MyAssembly;
        public static Assembly MyAssembly
        {
            get
            {
                return _MyAssembly;
            }
            set
            {
                _MyAssembly = value;
            }
        }
        //private static Assembly _MyAssemblyTable;
        //public static Assembly MyAssemblyTable
        //{
        //    get
        //    {
        //        return _MyAssemblyTable;
        //    }
        //    set
        //    {
        //        _MyAssemblyTable = value;
        //    }
        //}

        #region   静态方法
        /// <summary>
        /// 根据 类名  获取类的全名称
        /// </summary>
        /// <param name="name">类的名称</param>
        /// <param name="parentType">基类的类型</param>
        /// <returns></returns>
        public static  string GetTypeFullName(string name, System.Type  parentType)
        {
            string fullName = string.Empty;
            if (_MyAssembly != null)
            {
                System.Type[] AllTypes = _MyAssembly.GetTypes();
                foreach (System.Type type in AllTypes)
                {
                    if (type.Name == name && type.IsSubclassOf(parentType))
                    {
                        fullName = type.FullName;
                        break;
                    }
                }
            } 
            return fullName;

        }
        #endregion
    }
}
